/*
 * @Author: silence silence9685@163.com
 * @Date: 2023-04-23 10:15:22
 * @LastEditors: silence silence9685@163.com
 * @LastEditTime: 2023-06-13 16:01:44
 * @FilePath: \lenercom_bluetooth_app\lib\pages\Mine\Feedback\FeedbackPage.dart
 * @Description: 帮助中心-list-item
 */
import 'package:flutter/material.dart';
import 'package:sil_base_widget_package/sil_base_widget_package.dart';

import '../../../../common/widgets/cubitWidget/DividingLine.dart';
import '../../../../utils/color/ColorUtils.dart';

class HelpFaqsItemView extends StatefulWidget {
  const HelpFaqsItemView({Key? key}) : super(key: key);

  @override
  State<HelpFaqsItemView> createState() => _HelpFaqsItemViewState();
}

class _HelpFaqsItemViewState extends State<HelpFaqsItemView> {
  bool _isUnfold = false; // 是否展开

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        /// 标题
        titleView(),

        /// 内容
        contentView(),

        /// 底部分割线
        DividingLine(),
      ],
    );
  }

  contentView() {
    return Container(
      child: _isUnfold
          ? SilText(
              '本产品交流输出口额定功率为xxxW，峰值功率为xxxW,本产品具有.....?本产品交流输出口额定功率为xxxW，峰值功率为xxxW,本产品具有.....',
              fontSize: 12.sp,
              fontWeight: FontWeight.w400,
              color: ColorUtils.color_font_minor,
              maxLines: 0,
              lineHeight: 1.2,
              margin: EdgeInsets.only(top: 12.w, bottom: 18.w),
            )
          : Container(),
    );
  }

  titleView() {
    return SilEmptyButton(
      onTapFunc: () {
        setState(() {
          _isUnfold = !_isUnfold;
        });
      },
      useConstrained: true,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          SilText(
            '产品交流输出口能带什么设备?',
            fontSize: 14.sp,
            fontWeight: FontWeight.w400,
            color: ColorUtils.color_font_main,
            maxLines: 0,
            margin: EdgeInsets.only(top: 18.w, bottom: _isUnfold ? 0 : 18.w),
          ),
          // 右侧箭头
          Container(
              margin: EdgeInsets.only(left: 10.w),
              width: 24.w,
              height: 24.w,
              child: SilImage('imgs/personal/list_icon_arrow@3x.png'))
        ],
      ),
    );
  }
}
